#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <conio.h>
#include "video-graphics.h"
#include "utypes.h"
#include "kbc.h"
#include "music.h"
#include "rtc.h"
#include "timer.h"
#include "game.h"

#define COLOR 7 
#define LETTER_COLOR 1
#define PAUSE_FREQ 20

void kbd_isr(void);
void isr_handler(void);
extern int scancode;

int main()
{	
	_go32_dpmi_seginfo *old_irq;
	timer_init(0, LCOM_MODE);
	timer_init(2, LCOM_MODE);
	timer_load(0, TIMER_CLK/1000);
	
	install_asm_irq_handler(0,isr_handler,old_irq);
	
	srand ( time(NULL) );
	char **frase, *pal, *pal_esc, *letr_usa, tmp = NULL;
	frase = (char**)calloc(25, sizeof(char*));
	pal = (char*)calloc(25, sizeof(char));
	pal_esc = (char*)calloc(25, sizeof(char));
	letr_usa = (char*)calloc(25, sizeof(char));
	
	int y = lerTXT(frase);
	letr_usa = NULL;
	
	pal = obterPalavra(y,frase);
	int tam = strlen(pal),k;
	
	for(k=0; k < tam; k++)
		pal_esc[k] = '_';
	
	jogada(pal, pal_esc, tmp, letr_usa);
	reinstall_asm_irq_handler(0,old_irq);
	
	return 0;
}
